<template>
  <div class="scroll-wrapper" :style="wrapperStyle">
    <slot></slot>
  </div>
</template>

<script>

export default {
  props: ["width", "height"],
  computed: {
    wrapperStyle() {
      return `width: ${this.width}; height: ${this.height};`;
    }
  },
  mounted() {
    window.Scrollbar.init(this.$el, {alwaysShowTracks:true, damping: 0.6 });
  }
};
</script>

<style lang="stylus">
.scroll-wrapper
  overflow auto
  padding-right 0.5vw
  // margin-left 0.5vw
  width calc(100% - 1vw)

  .scrollbar-track-y
    width 12px
    background rgba(222, 222, 222, 0.1)

  .scrollbar-track-y:hover
    .scrollbar-thumb
      width 12px
      margin 0
      background rgba(64, 158, 255, 0.6)

  .scrollbar-track-x
    height 12px
    background rgba(222, 222, 222, 0.1)

  .scrollbar-track-x:hover>.scrollbar-thumb
      height 12px
      margin 0
      background rgba(64, 158, 255, 0.6)

  .scrollbar-thumb
    background rgba(64, 158, 255, 0.2)
    width 4px
    height 4px
    border-radius 20px
    margin 5px 0 0 5px

    transition width 100ms ease-out, height 100ms ease-out, margin 100ms ease-out, background 100ms ease-out


</style>